package test;

import static org.junit.Assert.*;
import hospital.Hospital;

import movement.Location;

import org.junit.*;


public class testHospital {
	
	Hospital hospital;
	Location hospLoc;
	
    @Before
    public void setUp() throws Exception { 
    	hospLoc = new Location(20,20,"HospLocation");
    	hospital = new Hospital("ValidHospital",hospLoc);
    }
    
    @Test 
    public void testCanHaveAsLocation(){
    	assertTrue(hospital.canHaveAsLocation(new Location(20,30,"Location")));
    	assertFalse(hospital.canHaveAsLocation(null));
    }
    
    @Test 
    public void testCanHaveAsName(){
    	assertTrue(hospital.canHaveAsName("Name"));
    	assertFalse(hospital.canHaveAsName(null));
    }
    
    @Test 
    public void testConstructorAndGetters(){
    	assertEquals(20, hospital.getLocation().getY());
    	assertEquals(20, hospital.getLocation().getX());
    	assertEquals("HospLocation", hospital.getLocation().getName());
    	assertEquals(hospLoc, hospital.getLocation());
    	assertEquals("ValidHospital",hospital.getName());
    }
    
    @SuppressWarnings("unused")
	@Test (expected=IllegalArgumentException.class)
    public void testConstructorNullLocation(){
    	Hospital hsptl = new Hospital("Jap", null);
    }
    
    @SuppressWarnings("unused")
    @Test (expected=IllegalArgumentException.class)
    public void testConstructorNullName(){
    	Hospital hsptl = new Hospital(null,hospLoc);
    }
}
